import type { AddpatientData, AddpatientParams, GetPatientMylistItem, PatientItem } from "@/types/patient"
import { request } from "@/utils/request"

/**
 * 添加患者
 */
export const addPatientAPI = (params:AddpatientParams) => {
  return request<AddpatientData>('/patient/add','POST',params)
}

/**
 * 获取患者（家庭档案）列表
 */
export const patientListAPI = () => {
  return request<PatientItem[]>('/patient/mylist','GET')
}

/**
 * 删除患者
 */
export const patientDeleteAPI = (id:string) => {
  return request(`/patient/del/${id}`,'DELETE')
}

/**
 * 问诊-查询患者详情
 * @param id 患者 id
 * @returns 返回患者详情
 */
export const getPatientInfoByIdAPI = (id: string) => {
  return request<GetPatientMylistItem>(`/patient/info/${id}`)
}

/**
 * 编辑患者
 * @param id 患者 id
 * @param params 患者信息
 * @returns 返回患者详情
 */
export const editPatientAPI = (params:AddpatientParams) => { 
  return request('/patient/update','PUT',params)
}
